# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
pkgname=rasdaemon
pkgver=0.6.8
pkgrel=0
pkgdesc="utility to receive RAS error tracings"
url="https://github.com/mchehab/rasdaemon"
arch="x86_64"
license="GPL-2.0-or-later"
depends="dmidecode
	perl
	perl-dbd-sqlite
	"
makedepends="argp-standalone
	sqlite-dev
	autoconf
	automake
	libtool
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mchehab/rasdaemon/archive/v$pkgver.tar.gz
	libargp.patch
	$pkgname.initd
	"

prepare() {
	default_prepare
	autoreconf -i
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-abrt-report \
		--enable-aer \
		--enable-devlink \
		--enable-diskerror \
		--enable-extlog \
		--enable-hisi-ns-decode \
		--enable-mce \
		--enable-non-standard \
		--enable-sqlite3
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
634638154c6b0bf7a079d6aba884a55e540c9edc3c25715a792ad7535c68629618e9cef8b6ec7e20845f78bd57f712d437be4d772523020f09d30cce42759a30  rasdaemon-0.6.8.tar.gz
83a484ab7b19dc22c2dae7636929379a70d775194566ee98012a783c7a2afa0b216ebe8b49f34f05bfe395f8f1e434ca7e739991943514faf3888689a284b781  libargp.patch
edee5b32765b3c89ab82e5cd410b0b381aa58470fdaed3a94516aa954845123b661a4923435f7d0bc9c33fb9b1e42a611dc1aa629a5db7d3e431164e4cd432cf  rasdaemon.initd
"
